﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using hlavny.modul1;

namespace hlavny.modul2
{
    public partial class ChangeColumnTypeForm : Form
    {
        private CAttribute attribute;
        public ChangeColumnTypeForm( CAttribute attribute)
        {
            this.attribute = attribute;
            InitializeComponent();

            comboBoxCahngeType.DataSource = null;
            comboBoxCahngeType.Items.Clear();
            comboBoxCahngeType.DataSource = CTypes.EnumTypes.GetNames(typeof(CTypes.EnumTypes));
        }

        private void buttonChangeType_Click(object sender, EventArgs e)
        {
            CTypes.EnumTypes type = (CTypes.EnumTypes)Enum.Parse(typeof(CTypes.EnumTypes), comboBoxCahngeType.SelectedValue.ToString());
            CDBS.SysColumns.SetType(attribute, type);
            if (type != CTypes.EnumTypes.Character)
            {
                CDBS.SysColumns.SetLength(attribute, 0);
            }
            this.DialogResult = DialogResult.OK;
        }
    }
}
